package com.qf.listener;

import com.event.util.EventHandler;
import com.event.util.EventType;
import com.qf.entity.Hotal;
import com.qf.service.ISearchService;
import com.qf.util.EventTypeContact;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@EventType(EventTypeContact.HOTAL_INSERT)
public class HotalInsertHandler implements EventHandler<Hotal> {

    @Autowired
    private ISearchService searchService;

    @Override
    public void msgHandler(Hotal hotal) {
        System.out.println("新增酒店：" + hotal);

        //将酒店信息保存到ES中
        searchService.insertHotal(hotal);
    }
}
